Private Sub Workbook_SheetPivotTableUpdate(ByVal Sh As Object, ByVal Target As PivotTable)

    Dim ʵ As PivotField
    Dim հ As Double
    
    For Each ʵ In Target.DataFields
    
        If ʵ.Function = xlCount Then
        
            Application.EnableEvents = False
    
                ʵ.Function = xlSum
                
                With Target.DataBodyRange
                
                    հ = .Cells(.Count).Value
                    
                    If հ = 0 Then ʵ.Function = xlCount
                    
                End With
            
            Application.EnableEvents = True
            
        End If
    
    Next
    
End Sub
